package com.banyuan.lesson.输入输出流;

import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
/*
* 高级流有缓冲区,大大的提高读取速度；
* */
public class TestBufferInputStream {
    public static void main(String[] args) {
        try(BufferedInputStream bis = new BufferedInputStream(new FileInputStream("aaa.txt"))) {
            byte[] buf = new byte[8];
            int len;
            StringBuilder s = new StringBuilder();
            while ((len = bis.read(buf)) != -1){
                s.append(new String(buf,0,len));
            }
            System.out.println(s);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
